<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%signup}}".
 *
 * @property integer $id
 * @property string $openid
 * @property string $name
 * @property string $tel
 * @property string $idcard
 * @property string $profession
 * @property string $thumb
 * @property integer $created_at
 */
class Signup extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%signup}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'tel'], 'required'],
            [['created_at'], 'integer'],
            [['openid', 'nickname'], 'string', 'max' => 32],
            [['name', 'profession'], 'string', 'max' => 20],
            ['tel', 'number'],
            ['tel', 'string', 'length' => [11, 11]],
            ['name', 'string', 'min' => 2],
            ['idcard', 'string', 'length' => [18, 18]],
            [['thumb'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png,jpg,jpeg,gif'],
            ['created_at', 'default', 'value' => time()]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'openid' => 'Openid',
            'name' => '姓名',
            'nickname' => '微信昵称',
            'tel' => '手机',
            'idcard' => '身份证',
            'profession' => '职业',
            'thumb' => '截图',
            'created_at' => '报名时间',
        ];
    }
}
